#include<iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;
struct Team{
	string name;
    int points = 0;       // 积分
    int goal_diff = 0;    // 净胜球
    int goals_scored = 0; // 进球数

    // 排序比较函数：先比积分，再比净胜球，最后比进球数
    bool operator<(Team& other){
        if (points != other.points)
            return points > other.points;
        if (goal_diff != other.goal_diff)
            return goal_diff > other.goal_diff;
        if (goals_scored != other.goals_scored)
            return goals_scored > other.goals_scored;
        return name < other.name; // 如果都一样，按字典序排用于唯一性判定
    }
};
int main(){
	int n;
    cin >> n;
    unordered_map<string, Team> team_db;
    vector<string> team_names;
	//输入球队的名字
	for (int i = 0; i < n; ++i) {
        string name;
        cin >> name;
        team_names.push_back(name);
        team_db[name] = {name, 0, 0, 0};//初始化
    }
	//输入所有队伍的比赛结果
	int match_count = n * (n - 1) / 2;
	for (int i = 0; i < match_count; ++i){
		string team_pair, score;
        cin >> team_pair >> score;
        
         // 解析主队和客队名
        size_t dash_pos = team_pair.find('-');
        string home = team_pair.substr(0, dash_pos);
        string away = team_pair.substr(dash_pos + 1);
        
        //解析比分
        size_t colon_pos=score.find(':');
        int home_goals=stoi(score.substr(0,colon_pos));
        int away_goals=stoi(score.substr(colon_pos + 1));
        
        Team&home_team=team_db[home];
        Team& away_team = team_db[away];
        int goal_diff = home_goals - away_goals;
        
        //更新进球数
        home_team.goals_scored += home_goals;
        away_team.goals_scored += away_goals;
        
         // 更新净胜球
        home_team.goal_diff += goal_diff;
        away_team.goal_diff -= goal_diff;
        
        // 更新积分
        if (goal_diff > 0) {
            home_team.points += 3;
        } else if (goal_diff < 0) {
            away_team.points += 3;
        } else {
            home_team.points += 1;
            away_team.points += 1;
        }
	}
	// 将所有球队放入 vector 中进行排序
    vector<Team> teams;
    for (const auto& pair : team_db) {
        teams.push_back(pair.second);
    }
    
    // 按照规则排序
    sort(teams.begin(), teams.end());
    
     // 取出前 n/2 名，并再次按字典序排序后输出
    vector<string> qualified;
    for (int i = 0; i < n / 2; ++i) {
        qualified.push_back(teams[i].name);
    }
      // 字典序排序输出
    sort(qualified.begin(), qualified.end());
    for (const string& name : qualified) {
        cout << name << endl;
    }

	return 0;
}